﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace WpfWordsLearner.Model
{
	public class WordsModel : DependencyObject
	{
		public string EnglishWord
		{
			get { return (string)GetValue(EnglishWordsProperty); }
			set { SetValue(EnglishWordsProperty, value); }
		}
		public static readonly DependencyProperty EnglishWordsProperty =
			DependencyProperty.Register("EnglishWord", typeof(string), typeof(WordsModel), new PropertyMetadata(string.Empty));

		public string Translate
		{
			get { return (string)GetValue(TranslateProperty); }
			set { SetValue(TranslateProperty, value); }
		}
		public static readonly DependencyProperty TranslateProperty =
			DependencyProperty.Register("Translate", typeof(string), typeof(WordsModel), new UIPropertyMetadata(string.Empty));


		public bool IsComplicated
		{
			get { return (bool)GetValue(IsComplicatedProperty); }
			set { SetValue(IsComplicatedProperty, value); }
		}
		public static readonly DependencyProperty IsComplicatedProperty =
			DependencyProperty.Register("IsComplicated", typeof(bool), typeof(WordsModel), new UIPropertyMetadata(false));


		public new bool Equals(object obj)
		{
			if (obj != null && obj is WordsModel)
			{
				if (string.Compare(EnglishWord.Trim().ToLower(), (obj as WordsModel).EnglishWord.Trim().ToLower()) == 0
					&& string.Compare(Translate.Trim().ToLower(), (obj as WordsModel).Translate.Trim().ToLower()) == 0
					&& IsComplicated.Equals((obj as WordsModel).IsComplicated))
					return true;

				return false;
			}
			return false;
		}

	}
}
